<template>
  <div class="p-30">
    <van-cell-group inset>
      <van-field
        v-model="user.username"
        label="账号"
        placeholder="请输入账号"
      />
      <van-field
        v-model="user.password"
        label="密码"
        placeholder="请输入密码"
      />
    </van-cell-group>
    <van-button type="primary" block class="m-t-10" @click="handleReg">注册</van-button>
  </div>
</template>

<script setup>
import { reactive } from "@vue/reactivity";
import { userReg } from '../api/user'
import { Notify } from 'vant'
import { useRouter } from 'vue-router'
// import 'vant/es/notify/style';
let router = useRouter()   //Hook方法，必须放在逻辑代码最外层调用
let user = reactive({
  username:'张三丰',
  password:'123'
})

let handleReg = ()=>{
  userReg(user).then(res=>{
    console.log(res);
    // Notify({ type: 'success', message: '注册成功' });
    // router.back()
  })
}
</script>

<style lang="less" scoped>

</style>